<%template _pageheader%>
<style>
body{
 text-align:left;background:#F5FAFD;
}
.collapse,.expand{position: absolute;background-image:url({imagedir}/collapse.gif);background-repeat:no-repeat;background-position:50% 50%;width:6px; height:50px;}
.expand {background-image:url({imagedir}/expand.gif);}
</style>
<body onLoad="window_load();">
<script type="text/javascript" src="{jsdir}/ajax.js"></script>
<script type="text/javascript">
		var NoUser = {userid} == -1 ? true : false;
		var lastA = null;		
		function window_load(){
			documentbody = document.documentElement.clientHeight > document.body.clientHeight ? document.documentElement : document.body;
			var leftbar = document.getElementById('leftbar')
			leftbar.style.height = documentbody.clientHeight +'px';
			leftbar.style.left = 0; //document.body.clientWidth - 6;
			leftbar.style.top = documentbody.scrollTop + 'px'; //document.body.clientWidth - 6;
			document.onscroll = function(){ 
											leftbar.style.height=documentbody.clientHeight +'px';
											leftbar.style.top=documentbody.scrollTop + 'px'; 
										}
										
			document.onresize = function(){ 
											leftbar.style.height=documentbody.clientHeight +'px';
											leftbar.style.top=documentbody.scrollTop + 'px'; 
										}
			
		}
		
		function resizediv_onClick(){
			if (document.getElementById('menubar').style.display != 'none'){
				top.document.getElementsByTagName('FRAMESET')[0].cols = "6,*";
				document.getElementById('menubar').style.display = 'none';
				document.getElementById('leftbar').className = "expand";
			}
			else{
				top.document.getElementsByTagName('FRAMESET')[0].cols = "210,*";
				document.getElementById('leftbar').className = "collapse";
				document.getElementById('menubar').style.display = '';
			}
		
		}
		
		//↓----------获得版块的树形列表相关脚本-------------------------
		function changeExtImg(objImg){
			if (!objImg){ return; }	
			var fileName = objImg.src.toLowerCase().substring(objImg.src.lastIndexOf("/"));
			switch(fileName){
				case "/p0.gif":
					objImg.src = "images/tree/m0.gif";
					break;
				case "/p1.gif":
					objImg.src = "images/tree/m1.gif";
					break;
				case "/p2.gif":
					objImg.src = "images/tree/m2.gif";
					break;
				case "/p3.gif":
					objImg.src = "images/tree/m3.gif";
					break;
				case "/m0.gif":
					objImg.src = "images/tree/p0.gif";
					break;
				case "/m1.gif":
					objImg.src = "images/tree/p1.gif";
					break;
				case "/m2.gif":
					objImg.src = "images/tree/p2.gif";
					break;
				case "/m3.gif":
					objImg.src = "images/tree/p3.gif";
					break;
			}
		}

		function changeFolderImg(objImg){
			if (!objImg){ return; }	
			var fileName = objImg.src.toLowerCase().substring(objImg.src.lastIndexOf("/"));
			switch(fileName){
				case "/folder.gif":
					objImg.src = "images/tree/folderopen.gif";
					break;
				case "/folderopen.gif":
					objImg.src = "images/tree/folder.gif";
					break;
			}
		}
		
		
		function a_click(objA){
			if (lastA){
				lastA.className=''; 
			}
			objA.className='bold'; 
			lastA = objA; 
		}

		function writesubforum(objreturn,fid,AtEnd){
			var process = document.getElementById("process_" + fid);
			var forum = document.getElementById("forum_" + fid);
			var dataArray = objreturn.getElementsByTagName('forum');
			var dataArrayLen = dataArray.length;
			
			changeExtImg(document.getElementById("forumExt_" + fid));
			changeFolderImg(document.getElementById("forumFolder_" + fid));
			
			for (i=0;i<dataArrayLen;i++){
				var thisfid = dataArray[i].getAttribute("fid");
				var subforumcount = dataArray[i].getAttribute("subforumcount");
				var thisEnd = i==dataArrayLen-1;
				
				var layer = dataArray[i].getAttribute("layer");

					//显示树型线
					list = "";
					
					for (l=1;l<=layer;l++){
						if (AtEnd && NoUser){
							list += "<nobr><img src = \"images/tree/L5.gif\" align=\"absmiddle\" />";
						}
						else{
							list += "<img src = \"images/tree/L4.gif\" align=\"absmiddle\" />";
						}
					}
					if (subforumcount>0){
						folder = "folder.gif";
						if (layer==0 && thisEnd){
							if (NoUser){
								src = "p2.gif";
							}
							else{
								src = "p1.gif";
							}
						}
						else{
							if (thisEnd && layer>0){
								src = "P2.gif";
							}
							else{
								//if (i==0 && layer==0){
								//	src = "P0.gif";
								//}
								//else{
									src = "P1.gif";
								//}
							}
						}
					}
					else{
						folder = "file.gif";
						if (layer==0 && thisEnd){
							if (NoUser){
								src = "m2.gif";
							}
							else{
								src = "m1.gif";
							}
						}
						else{
							if (thisEnd){
								src = "L2.gif";
							}
							else{
								//if (i==0 && layer==0){
								//	src = "L0.gif";
								//}
								//else{
									src = "L1.gif";
								//}
							}
						}
					}
					
					if({config.aspxrewrite})
					{
						list += "<img id=\"forumExt_" + thisfid + "\" src = \"images/tree/" + src + "\" align=\"absmiddle\" /><img id=\"forumFolder_" + thisfid + "\" src = \"images/tree/" + folder + "\" align=\"absmiddle\" /> <a href=\"showforum-" + thisfid + ".aspx\" target=\"main\" title=\"" + dataArray[i].getAttribute("name") + "\" onclick=\"a_click(this);\">" + dataArray[i].getAttribute("name") + "</a></nobr>";
					}
					else
					{
						list += "<img id=\"forumExt_" + thisfid + "\" src = \"images/tree/" + src + "\" align=\"absmiddle\" /><img id=\"forumFolder_" + thisfid + "\" src = \"images/tree/" + folder + "\" align=\"absmiddle\" /> <a href=\"showforum.aspx?forumid=" + thisfid + "\" target=\"main\" title=\"" + dataArray[i].getAttribute("name") + "\" onclick=\"a_click(this);\">" + dataArray[i].getAttribute("name") + "</a></nobr>";
					}


				var div_forumtitle =  document.createElement("DIV");
					div_forumtitle.id = "forumtitle_" + thisfid;
					div_forumtitle.className = "tree_forumtitle";
					if (subforumcount>0){
						div_forumtitle.onclick = new Function("getsubforum(" + thisfid + "," + thisEnd + ");");
					}
					div_forumtitle.innerHTML = list;
					forum.appendChild(div_forumtitle);
					
				var div_forum = document.createElement("DIV");
					div_forum.id = "forum_" + thisfid;
					div_forum.className = "tree_forum";
					forum.appendChild(div_forum);
				
				
			}
			process.style.display="none";
		}
		
		
		
		function getsubforum(fid,AtEnd){
			if (!document.getElementById("forum_" + fid)){
				document.writeln("<div id=\"forum_" + fid + "\"></div>");
			}
			if (!document.getElementById("process_" + fid)){
				var div = document.createElement("DIV");
				div.id = "process_" + fid;
				div.className = "tree_process";
				div.innerHTML = "<img src='images/common/loading.gif' />载入中...";
				
				document.getElementById("forum_" + fid).appendChild(div);
				
				ajaxRead("tools/ajax.aspx?t=forumtree&fid=" + fid, "writesubforum(obj," + fid+ "," + AtEnd + ");");
			}
			else{
				changeExtImg(document.getElementById("forumExt_" + fid));
				changeFolderImg(document.getElementById("forumFolder_" + fid));
				if (document.getElementById("forum_" + fid).style.display == "none"){
					document.getElementById("forum_" + fid).style.display = "block";
				}
				else{												
					document.getElementById("forum_" + fid).style.display = "none";
				}
			}

		}
		
		//↑----------获得版块的树形列表相关脚本-------------------------
		
</script>
<div id="leftbar" class="collapse" onmouseover="this.style.backgroundColor='#A7E8F3';" onmouseout="this.style.backgroundColor = '';" onclick="resizediv_onClick()" style="width:6px; cursor:pointer" title="打开/关闭导航"></div>
<div id="menubar" style="white-space:nowrap;">
	<div id="frameback">
		<A href="###" onClick="resizediv_onClick()" class="hideside">隐藏侧栏</a><A href="forumindex.aspx?f=0" target="_top" class="back">平板模式</a>
	</div>
	<div class="framemenu">
	<ul>
	<%if {userid}!=-1%>
		<li>欢迎访问{config.forumtitle}</li>
		<li><%set {aspxrewriteurl} = this.UserInfoAspxRewrite({userinfo.uid})%>				
		<a href="{aspxrewriteurl}" target="main" class="lightlink">{userinfo.username}</a> [ <a href="logout.aspx?userkey={userkey}&amp;reurl=index.aspx" target="main">退出</a> ]</li>
		<li>积分: <span class="lightlink">{userinfo.credits}</span>  [<span id="creditlist" onMouseOver="showMenu(this.id, false);" style="CURSOR:pointer">详细积分</span>]</li>
		<li>头衔: {usergroupinfo.grouptitle}
			<%if {useradminid}==1%>
				| <a href="admin/index.aspx" target="_blank">系统设置</a>
			<%/if%>
		</li>
	<%else%>
		<li>头衔: 游客
			[<a href="register.aspx" target="main">注册</a>] 
			[<a href="login.aspx?reurl=index.aspx" target="main">登录</a>]
		</li>
	<%/if%>
	<%if {oluserinfo.newpms}>0%>
		<li>
			新的短消息<a href="usercpinbox.aspx" target="main"><span id="newpmcount" class="lightlink">{oluserinfo.newpms}</span></a>条
		</li>
	<%/if%>
		<li><hr class="solidline"/></li>
		<li>
			<img src="{imagedir}/home.gif">
			<a href="forumindex.aspx" target="main">论坛首页</a>
		</li>
		<li>
			<img src="images/tree/L1.gif" width="20" height="20" /><img src="{imagedir}/folder_new.gif" width="20" height="20" />
			<a href="showtopiclist.aspx?type=newtopic&amp;newtopic={newtopicminute}&amp;forums=all" target="main">查看新帖</a>
		</li>
		<li>
			<img src="images/tree/L1.gif" width="20" height="20"><img src="{imagedir}/showdigest.gif" width="20" height="20" />
			<a href="showtopiclist.aspx?type=digest&amp;forums=all" target="main">精华帖区</a>
		</li>
	</ul>
	<script type="text/javascript">
		//生成版块列表
		getsubforum(0);
	</script>
	<%if {userid}!=-1%>
	<div onClick="getsubforum(-1,true);">
		<img id="forumExt_-1" src="images/tree/M2.gif" width="20" height="20" /><img id="forumFolder_-1" src="{imagedir}/mytopic.gif" /><span class="cursor">用户功能区</span>
	</div>
	<div id="process_-1"></div>
	<div id="forum_-1" style="display:block;">
		<div><img src="images/tree/L5.gif" width="20" height="20" border="0"><img src="images/tree/L1.gif" width="20" height="20" border="0"><img src="{imagedir}/folder_mytopic.gif" width="16" height="16">
			<a href="mytopics.aspx" target="main">我的主题</a></div>
		<div><img src="images/tree/L5.gif" width="20" height="20" border="0"><img src="images/tree/L1.gif" width="20" height="20" border="0"><img src="{imagedir}/folder_s.gif" width="16" height="16">
			<a href="myposts.aspx" target="main">我的帖子</a></div>
		<div><img src="images/tree/L5.gif" width="20" height="20" border="0"><img src="images/tree/L1.gif" width="20" height="20" border="0"><img src="{imagedir}/digest.gif">
			<a href="search.aspx?posterid={userid}&amp;type=digest" target="main">我的精华</a></div>
		<div><img src="images/tree/L5.gif" width="20" height="20" border="0"><img src="images/tree/L1.gif" width="20" height="20" border="0"><img src="{imagedir}/favorite.gif">
			<a href="usercpsubscribe.aspx" target="main">我的收藏</a></div>
		<div><img src="images/tree/L5.gif" width="20" height="20" border="0"><img src="images/tree/L1.gif" width="20" height="20" border="0"><img src="{imagedir}/usericon.gif">
			<a href="usercp.aspx" target="main">用户中心</a></div>
		<div><img src="images/tree/L5.gif" width="20" height="20" border="0"><img src="images/tree/L2.gif" width="20" height="20" border="0"><img src="{imagedir}/pm_1.gif" width="16" height="16">
			<a href="usercppostpm.aspx" target="main">撰写短消息</a></div>
	</div>
	<%/if%>
	</div>
	<hr class="solidline"/>
	<div class="framemenu">
		<ul>
			<li>在线用户: </li>
			<li>{totalonline}人在线  ({totalonlineuser}位会员) </li>
			<%if {config.rssstatus}!=0%>
			<li>
			<a href="tools/rss.aspx" target="_blank"><img src="{imagedir}/rss2.gif" alt="RSS订阅全部论坛"></a>
			</li>
			<%/if%>
		 </ul>
	</div>
</div>
<%template _footer%>
<ul id="creditlist_menu" class="popupmenu_popup" style="display:none;">
	<%if {score[1]}!=""%>
	<li>{score[1]}: {userinfo.extcredits1}</li>
	<%/if%>
	<%if {score[2]}!=""%>
	<li>{score[2]}: {userinfo.extcredits2}</li>
	<%/if%>
	<%if {score[3]}!=""%>
	<li>{score[3]}: {userinfo.extcredits3}</li>
	<%/if%>
	<%if {score[4]}!=""%>
	<li>{score[4]}: {userinfo.extcredits4}</li>
	<%/if%>
	<%if {score[5]}!=""%>
	<li>{score[5]}: {userinfo.extcredits5}</li>
	<%/if%>
	<%if {score[6]}!=""%>
	<li>{score[6]}: {userinfo.extcredits6}</li>
	<%/if%>
	<%if {score[7]}!=""%>
	<li>{score[7]}: {userinfo.extcredits7}</li>
	<%/if%>
	<%if {score[8]}!=""%>
	<li>{score[8]}: {userinfo.extcredits8}</li>
	<%/if%>
</ul>